﻿<Window x:Class="CodeSHARPer.View.Dialogs.FolderBrowserView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
        xmlns:views="clr-namespace:CodeSHARPer.View"
        xmlns:cinch="clr-namespace:Cinch;assembly=Cinch.WPF"
        Title="Folder Browser" Height="300" Width="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TextBlock Text="{Binding FolderPath}" Grid.Row="0" Padding="3" />
        
        <views:FolderBrowseTreeView x:Name="tree" Grid.Row="1"  BorderThickness="0"
                                    ItemsSource="{Binding Items}" >
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseLeftButtonUp">
                    <cinch:EventToCommandTrigger 
                        Command="{Binding SelectFileCommand}" CommandParameter="{Binding ElementName=tree,Path=SelectedValue}"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </views:FolderBrowseTreeView>

        <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Content="OK" Width="75" IsDefault="True" Margin="5" Padding="3"
                    Command="{Binding CloseActivePopUpCommand}" CommandParameter="True" />
            <Button Content="Cancel" Width="75" IsCancel="True" Margin="5" Padding="3"/>
        </StackPanel>
    </Grid>
</Window>
